<div class="widget-box">
    <div class="widget-title"><span class="icon"><i class="icon-th"></i></span>
        <h5>Danh sách môn</h5>
    </div>
    <div class="widget-content nopadding">
        <table class="table table-bordered data-table">
            <thead>
            <tr>
<!--                <th>Mã môn</th>-->
                <th>Môn</th>
                <th>Thao tác</th>
            </tr>
            </thead>
            <tbody>
            <?php
            while ($rs = mysql_fetch_array($data)) {
                echo "
            <tr class='gradeA'>

                <td class='center'><b>{$rs["ten_mon"]}</b></td>
                <td class='text-align-center'>
                    <a href='cp.php?mod=mon&task=edit&id={$rs["id_mon"]}' class='tip-top' data-original-title='Sửa'>
                        <i class='icon-pencil'></i>
                    </a> <a href='#del" . $rs["id_mon"] . "' class='tip-top' data-toggle='modal' data-original-title='Xóa'>
                        <i class='icon-remove'></i>
                    </a>
                </td>
            </tr>
            ";
                echo '<div id="del' . $rs["id_mon"] . '" class="modal hide">
                <form method="post" action="cp.php?mod=mon&task=del">
                <input type="hidden" name="delid" value="' . $rs["id_mon"] . '">
                <div class="modal-header">
                    <button data-dismiss="modal" class="close" type="button">×</button>
                    <h3>Xác nhận</h3>
                </div>
                <div class="modal-body">
                    <p>Bạn có muốn xóa môn <b>' . $rs["ten_mon"] . '</b>?</p>
                </div>
                <div class="modal-footer"> <input type="submit" value="Có" class="btn btn-primary" /> <a data-dismiss="modal" class="btn" href="#">Không</a> </div>
                </form>
            </div>';

                $data2 = query("select * from mon where mon_me='{$rs["id_mon"]}'");
                while ($rs2 = mysql_fetch_array($data2)) {
                    echo "
            <tr class='gradeA'>

                <td class='center'><i>{$rs2["ten_mon"]}</i></td>
                <td class='text-align-center'>
                    <a href='cp.php?mod=mon&task=edit&id={$rs2["id_mon"]}' class='tip-top' data-original-title='Sửa'>
                        <i class='icon-pencil'></i>
                    </a> <a href='#del" . $rs2["id_mon"] . "' class='tip-top' data-toggle='modal' data-original-title='Xóa'>
                        <i class='icon-remove'></i>
                    </a>
                </td>
            </tr>";
                    echo '<div id="del' . $rs2["id_mon"] . '" class="modal hide">
                <form method="post" action="cp.php?mod=mon&task=del">
                <input type="hidden" name="delid" value="' . $rs2["id_mon"] . '">
                <div class="modal-header">
                    <button data-dismiss="modal" class="close" type="button">×</button>
                    <h3>Xác nhận</h3>
                </div>
                <div class="modal-body">
                    <p>Bạn có muốn xóa môn <b>' . $rs2["ten_mon"] . '</b>?</p>
                </div>
                <div class="modal-footer"> <input type="submit" value="Có" class="btn btn-primary" /> <a data-dismiss="modal" class="btn" href="#">Không</a> </div>
                </form>
            </div>';
                }
            }
            ?>
            </tbody>
        </table>
        <div class="form-actions">
            <a class="btn btn-success" href="cp.php?mod=mon&task=add">Thêm môn mới</a>
<!--            <a href="#delSelect" data-toggle="modal" class="btn btn-danger">Xóa những môn đã chọn</a>-->

            <div id="delSelect" class="modal hide">
                <form method="post" action="cp.php?mod=mon&task=del">
                    <div class="modal-header">
                        <button data-dismiss="modal" class="close" type="button">×</button>
                        <h3>Xác nhận</h3>
                    </div>
                    <div class="modal-body">
                        <p>Bạn có muốn xóa những môn đã chọn?</p>
                    </div>
                    <div class="modal-footer"><input type="submit" name="delSelect" class="btn btn-primary"/> <a
                            data-dismiss="modal" class="btn" href="#">Không</a></div>
                </form>
            </div>
        </div>
    </div>
</div>